package com.dc.trans.steps.bwzh;

import java.io.Serializable;

import com.dc.trans.steps.bwzh.metadata.interfaces.IMetadata;
import com.dc.trans.steps.bwzh.metadata.interfaces.IMetadataContainer;

/**
 * 项目：DAXMT <br>
 * 描述：数据包裹类型，用于对需要应用在Swing组件中的对象进行包装。该类可用于多种场合。 <br>
 * 日期：2004-8-2 10:14:23 <br>
 * 
 * @author 吴卫雄
 */
public class DataPack implements Serializable {

    /**
     * 数据包裹所包含的对象
     */
    private Object object;
    /**
     * 数据包裹的显示名称
     */
    private String name;
    private String absolutename;
    private int type=0;//增加对类型的控制，如果是0则是元素，如果是1则是属性    private boolean expand=false; //此树是否折叠
    private String express;
    private Boolean IsParent=false;
    private Boolean IsForEachParent=false;
    private String forEacheParent="";
    public String getForEacheParent() {
		return forEacheParent;
	}

	public void setForEacheParent(String forEacheParent) {
		this.forEacheParent = forEacheParent;
	}

	public Boolean getIsForEachParent() {
		return IsForEachParent;
	}

	public void setIsForEachParent(Boolean isForEachParent) {
		IsForEachParent = isForEachParent;
	}

	public Boolean getIsParent() {
		return IsParent;
	}

	public void setIsParent(Boolean isParent) {
		IsParent = isParent;
	}

	public Boolean getIsFor() {
		return IsFor;
	}

	public void setIsFor(Boolean isFor) {
		IsFor = isFor;
	}

	private Boolean IsFor=false;
    public DataPack() {
    }

    public String getAbsolutename()
	{
		return absolutename;
	}

	public void setAbsolutename(String absolutename)
	{
		this.absolutename = absolutename;
	}

	public DataPack(String name, Object obj) {
        this.name = name;
        this.object = obj;
    }

    @Override
	public String toString() {
    	String nodeName=this.name;
    	if(object instanceof IMetadataContainer)
    	{
    		IMetadataContainer metada=(IMetadataContainer)object;
    		if(metada.getProperty("metadatatype")!=null&&!metada.getProperty("metadatatype").equals(""))
    			nodeName=nodeName+"_"+metada.getProperty("metadatatype");	
    	}
    	if(object instanceof IMetadata)
    	{
    	IMetadata metada=(IMetadata)object;
    	
    	if(metada.getProperty("name")!=null&&!metada.getProperty("name").equals(""))
    		nodeName=nodeName+"_name:"+metada.getProperty("name");
    	if(metada.getProperty("type")!=null&&!metada.getProperty("type").equals(""))
    		nodeName=nodeName+"_type:"+metada.getProperty("type");
    	}
    	
        return nodeName;
    }

    /**
     * 向客户程序返回数据包中的对象
     * 
     * @return
     */
    public Object getObject() {
        return this.object;
    }

    /**
     * 设置数据包裹中的对象
     * 
     * @param obj
     */
    public void setObject(Object obj) {
        this.object = obj;
    }

    /**
     * 向客户程序返回数据包裹的名称
     * 
     * @return
     */
    public String getName() {
        return name;
    }

    /**
     * 设置数据包裹的名称
     * 
     * @param string
     */
    public void setName(String string) {
        this.name = string;
    }

	public int getType()
	{
		return type;
	}

	public void setType(int type)
	{
		this.type = type;
	}

	public String getExpress()
	{
		return express;
	}

	public void setExpress(String express)
	{
		this.express = express;
	}

	public boolean isExpand()
	{
		return expand;
	}

	public void setExpand(boolean expand)
	{
		this.expand = expand;
	}

	

}